import request from '@/utils/request'

export function apiGetList(params, loading) {
  return request({
    url: `/permission/menuController/listHasChildren`,
    method: 'get',
    params,
    loading,
    autoUntie: false,
  })
}
export function apiGetPreMenuList() {
  return request({
    url: `/permission/menuController/listTree`,
    method: 'get',
    resField: 'data',
  })
}

export function apiAdd(data, loading) {
  return request({
    url: '/permission/menuController/add',
    method: 'post',
    data,
    loading,
  })
}
export function apiEdit(data, loading) {
  return request({
    url: '/permission/menuController/edit',
    method: 'put',
    data,
    loading,
  })
}
// 删除
export function apiDel(ids) {
  return request({
    url: '/permission/menuController/' + ids,
    method: 'delete',
  })
}

// 刷新缓存
export function apiRefreshCache(loading) {
  return request({
    url: '/cache/cacheController/refresh',
    method: 'post',
    data: ['resourceMenu'],
    loading,
  })
}
